#ifndef __LDX_CSHADERMANAGER_H_INCLUDE__
#define __LDX_CSHADERMANAGER_H_INCLUDE__
#include "LDXConfig.h"
#include "IReferenceCounted.h"
#include "IProgram.h"
#include "CProgramVPS.h"
#include "CShadersCache.h"
#include "PublicShaderDefines.h"
#include "CBufferObject.h"

namespace ldx
{
	namespace render
	{
		// Shader and program manager.
		class CShaderManager:public IReferenceCounted
		{

		public:

			CShaderManager(CRenderDriverD3D11* driver);

			~CShaderManager();
			
			//add a program with vs and ps.
			CProgramVPS* addProgramVPS(std::string progName,
				mt::wchar* vsFile, char* vsPort,
				mt::uint vslayercount,  D3D11_INPUT_ELEMENT_DESC* descs,
				mt::wchar* psFile, char* psPort);

			bool isProgramExist(std::string& name);

			IProgram* getProgram(const std::string& proName)const;

			int insertProgram(std::string& name, IProgram* prog);

		private:


			void clearPrograms();

			std::unordered_map<std::string, IProgram*> HashMapOfPrograms;
			CShadersCache ShaderCoache;
			CRenderDriverD3D11* Driver;
		};
	}
}

#endif//! __LDX_CSHADERMANAGER_H_INCLUDE__